use std::ptr::NonNull;

#[inline(always)]
pub fn as_mut<T>(r: &T) -> &mut T {
    unsafe { NonNull::new_unchecked(r as *const T as *mut T).as_mut() }
}

#[inline(always)]
pub fn new_buf(n: usize) -> Box<[u8]> {
    unsafe { 
        let mut buf = Vec::with_capacity(n);
        buf.set_len(n);
        buf.into_boxed_slice() 
    }
}
